/*
 * @Author: lihaogn
 * @Date: 2022-01-23 21:19:57
 * @LastEditTime: 2022-01-23 21:30:58
 * @LastEditor: lihaogn
 * @Description: 上传的文件模型
 * @FilePath: \lix-admin-server\app\model\upload.js
 */
"use strict";

module.exports = (app) => {
  const { STRING, DATE } = app.Sequelize;

  const Upload = app.model.define(
    "upload",
    {
      id: { type: STRING(40), primaryKey: true },
      name: { type: STRING, allowNull: false },
      path: { type: STRING, allowNull: false },
      url: { type: STRING, allowNull: false },
      createdAt: { type: DATE, field: "created_at" },
      updatedAt: { type: "TIMESTAMP", field: "updated_at" },
    },
    {
      tableName: "uploads",
    }
  );

  return Upload;
};
